package com.ctshk.rpc.train;


import com.ctshk.common.utils.DateUtil;
import com.ctshk.rpc.train.entity.TrainProductCostDate;
import com.ctshk.rpc.train.req.TrainProductCostDateReq;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class DateTest {

    public static void main(String []args) {
        String str1 = "2021-03-11";
        String str2 = "2021-03-20";
        String str3 = "2021-03-18";
        String str4 = "2021-03-28";

        String s = "4-1-100";
        System.out.println(s.substring(4,s.length()));

        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate date1 = LocalDate.parse(str1, fmt);
        LocalDate date2 = LocalDate.parse(str2, fmt);

        TrainProductCostDateReq productCostDateReq = new TrainProductCostDateReq();
        productCostDateReq.setDateBegin(date1);
        productCostDateReq.setDateEnd(date2);


        LocalDate date3 = LocalDate.parse(str3, fmt);
        LocalDate date4 = LocalDate.parse(str4, fmt);
        TrainProductCostDate costDateReqTemp = new TrainProductCostDate();
        costDateReqTemp.setDateBegin(date3);
        costDateReqTemp.setDateEnd(date4);

        boolean flag =  DateUtil.match(productCostDateReq.getDateBegin(), productCostDateReq.getDateEnd(), costDateReqTemp.getDateBegin(), costDateReqTemp.getDateEnd());
        System.out.println(flag);
    }


}
